package com.itheima.controller;

import com.itheima.mapper.BdMapper;
import com.itheima.pojo.Article;
import com.itheima.service.BdService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hot")
public class Controller {

    @Autowired
    private BdService bdService;

    @GetMapping("/hotTop")
    public List<Article> findAll() {

        //调用service,查询所有
        List<Article> all = bdService.findAll();
        return all;
    }


    @PostMapping("/addHotCount")
    public Map updataById(Long id, Integer status){
      //调用Service添加状态
        return bdService.addById(id,status);
    }
}
